// npm install -g ts-node

class Animal {
    name: string;
    static  categories : string[] = ['mammal','bird']
    static isAnimal (q) {
        return q instanceof Animal
    }
    constructor(name: string) {
        this.name = name
    }
    run () {
        return `${this.name} is running`
    }

}


// 修饰符分为 public,protected,private,static
console.log(Animal.categories)
const pig = new Animal('pig')
console.log(Animal.isAnimal(pig))

class Dog extends Animal{
    bark() {
        return `${this.name} is wangwang`
    }

}

const dog = new Dog('dog')

class Cat extends Animal{
    constructor(name:string) {
        super(name)
        console.log(this.name)
    }
    run() {
        return `'123'` + super.run()
    }

}

const cat = new Cat('cat')
cat.run()


interface IRadio {
   switchRadioStaus () : void;
}

interface IBattery {
   checkBatteryStatus()
}

interface IRadioOfIBattery extends IRadio{ // 接口的继承
    checkBatteryStatus()
}

class Car implements IRadio{
    switchRadioStaus () {

    }
}

// class Iphone implements IRadio,IBattery{
//     switchRadioStaus () {
//
//     }
//     checkBatteryStatus () {
//
//     }
// }

class Iphone implements IRadioOfIBattery{
    switchRadioStaus () {

    }
    checkBatteryStatus () {

    }
}
